# -*-coding: utf-8 -*-

from datetime import timedelta
# from celery.schedules import crontab

# 任务队列
broker_url = 'redis://127.0.0.1:6379/2'
# 结果保存
result_backend = 'redis://127.0.0.1:6379/1'
# 时区
celery_timezone = 'Asia/shanghai'
# # 设置并发worker数量
worker_concurrency = 1
# 允许重试
task_acks_late = True
# 每个worker最多执行100个任务被销毁，可以防止内存泄漏
worker_max_tasks_per_child = 100
# 超时时间
task_time_limit = 12 * 30
# 任务文件
imports = (
    'celery_app.task1',
)

# 定时任务
beat_schedule = {
    # 'regression_task': {
    #     'task': 'celery_app.task1.regression_execute',
    #     'schedule': timedelta(seconds=30),  # 每 60 秒执行一次
    #     # 'args': (4,)  # 任务函数参数
    # },
    'base_task': {
        'task': 'celery_app.task1.base_schedule_task',
        'schedule': timedelta(seconds=1),  # 每 1 秒执行一次
    },
}
